'use strict';

module.exports = function collectSameElements(collectionA, collectionB) {
    let arr = [] ;
    for(let item1 of collectionA){
        for(let item2 of jiangwei_conat(collectionB)){
            if(item1 === item2){
                arr.push(item1);
            }
        }
    }
    return arr ;
}
//  const collectionB = [[[['a', 'd', 'e', 'f',1]]]];
// let a = collectionB + 1 ;隐式类型转换
// console.log(a) ;
//只能降一层数组
function jiangwei_conat(array){
    let arr_one = [] ;
    for(let item of array ){
        arr_one = arr_one.concat(item) ;
    }
    return arr_one ;
}
// let  a = jiangwei_conat(collectionB) ;
// console.log(a) ;